package com.cc.teambuiding.controller;

import com.cc.teambuiding.entity.Squad;
import com.cc.teambuiding.service.SquadService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/squad")
@Tag(name = "小组管理")
public class SquadController {

    @Autowired
    private SquadService squadService; 

    @GetMapping("/list")
    @Operation(summary = "获取所有小组")
    public List<Squad> listSquads() {
        return squadService.listSquads();
    }

    @PostMapping("/add")
    @Operation(summary = "添加小组")
    public boolean addSquad(@RequestBody Squad squad) {
        return squadService.addSquad(squad);
    }
}